{% extends 'myadmin/base.html' %}

{% block title %}
<title>图书添加</title>
{% endblock %}

{% block content %}
  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">图书添加</strong> / <small>Personal information</small></div>
      </div>

      <hr/>

      <div class="am-g">

        <div class="am-u-sm-5 am-u-md-5 am-u-md-pull-12">
          <!-- 表单上传 -->
          <form class="am-form am-form-horizontal" action="{% url 'myadmin_book_insert' %}" method="post" enctype="multipart/form-data">
            {% csrf_token %}

            {% comment %}
            书名，作者，出版社，出版时间，价格，简介，书号ISBN，内容简介，所属分类，
            还需要添加：推荐语，封面、产品特色，作者简介，目录，媒体评论，试读
            {% endcomment %}

            <div class="am-form-group">
                <label class="am-u-sm-3 am-form-label">
                    商品所属分类
                </label>
                <select name="typeid" data-am-selected="{btnSize: 'sm'}" style="display: none;">
                  {% for v in typelist %}
                    <option value="{{ v.id }}" {% if v.pid == 0 %} disabled {% endif %} >{{ v.sj }}{{ v.name }}</option>
                  {% endfor %}
                </select>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">书名</label>
              <div class="am-u-sm-9">
                <input type="text" name="title" required placeholder="书名 必填">
                <small>必须填写</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">ISBN号</label>
              <div class="am-u-sm-9">
                <input type="text" name="ISBN" required placeholder="ISBN 必填">
                <small>可选</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">作者</label>
              <div class="am-u-sm-9">
                <input type="text" name="author" required placeholder="作者 必填">
                <small>必须填写</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">出版社</label>
              <div class="am-u-sm-9">
                <input type="text" name="publisher" placeholder="出版社">
                <small>可选</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">出版时间</label>
              <div class="am-u-sm-9">
                <input type="date" name="pub_date" class="form-control" placeholder="出版时间">
                <small>可选</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">价格</label>
              <div class="am-u-sm-9">
                <input type="text" name="price" placeholder="价格">
                <small>可选</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">简介</label>
              <div class="am-u-sm-9">
                <textarea class="form-control" name="jianjie" rows="3" placeholder="简介"></textarea>
                <small>可选</small>
              </div>
            </div>

            <!-- 优化 可以使用百度的富文本编辑器 -->
            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">内容</label>
              <div class="am-u-sm-9">
                <textarea class="form-control" name="content" rows="3" placeholder="内容"></textarea>
                <small>可选</small>
              </div>
            </div>

            <div class="am-form-group">
              <label class="am-u-sm-3 am-form-label">封面</label>
              <div class="am-u-sm-9">
                <input type="file" name="img_url" >
              </div>
            </div>

            <div class="am-form-group">
              <div class="am-u-sm-9 am-u-sm-push-3">
                <button type="submit" class="am-btn am-btn-primary">确认注册</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>

    <footer class="admin-content-footer">
      <hr>
      <p class="am-padding-left">© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </footer>

  </div>
  <!-- content end -->
{% endblock %}